﻿ 
using System.Collections.Generic;
using System.Threading.Tasks; 
using ArchivesAdmin.Util.Extension;
using ArchivesAdmin.Util.Model;
using ArchivesAdmin.Entity.TrainingManage;
using ArchivesAdmin.Model.Param.TrainingManage;
using ArchivesAdmin.Service.TrainingManage;
 

namespace ArchivesAdmin.Business.TrainingManage
{
    public class TeacherBLL
    {
        private TeacherService teacherService = new TeacherService();

        #region 获取数据
        public async Task<TData<List<TeacherEntity>>> GetList(TeacherListParam param)
        {
            TData<List<TeacherEntity>> obj = new TData<List<TeacherEntity>>();            
            obj.Result = await teacherService.GetList(param);
            obj.TotalCount = obj.Result.Count;
            obj.Tag = 1;
            return obj;
        }

        public async Task<TData<List<TeacherEntity>>> GetPageList(TeacherListParam param, Pagination pagination)
        {
            TData<List<TeacherEntity>> obj = new TData<List<TeacherEntity>>();
           
            obj.Result = await teacherService.GetPageList(param, pagination);
            obj.TotalCount = pagination.TotalCount;
            obj.Tag = 1;
            return obj;
        }
 
        public async Task<TData<TeacherEntity>> GetEntity(long id)
        {
            TData<TeacherEntity> obj = new TData<TeacherEntity>();
            obj.Result = await teacherService.GetEntity(id);
          
            obj.Tag = 1;
            return obj;
        }
 
        #endregion

        #region 提交数据
        public async Task<TData<string>> SaveForm(TeacherEntity entity)
        {
            TData<string> obj = new TData<string>();
          
            await teacherService.SaveForm(entity);
            obj.Result = entity.Id.ParseToString();
            obj.Tag = 1;
            return obj;
        }

        public async Task<TData> DeleteForm(string ids)
        {
            TData obj = new TData();
            await teacherService.DeleteForm(ids);
            obj.Tag = 1;
            return obj;
        }
        #endregion

        #region 私有方法
        #endregion
    }
}
